﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using MP.LayerHelper.MP_OBS.BLL;
using MP.LayerHelper.MP_OBS.DAL.EntityClasses;

public partial class Member_Tools_Control_Pages : MP.Core.Authentication.Control.AuthenBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadData();
        }
    }

    void LoadData()
    {
        DataTable tbl = MbPageManager.CreateInstant().SelectAllRDT();
        rep.DataSource = tbl;
        rep.DataBind();
    }

    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        for (int i = 0; i < rep.Items.Count; i++)
        {
            HiddenField hid = (HiddenField)rep.Items[i].FindControl("hidId");
            MbPageEntity p = MbPageManager.CreateInstant().SelectOne(hid.Value);
            if (p != null)
            {
                p.PageName = ((TextBox)rep.Items[i].FindControl("txt")).Text;
                p.ModCode = ((TextBox)rep.Items[i].FindControl("txtModule")).Text;
                MbPageManager.CreateInstant().Update(p);
            }
        }
        Response.Redirect(Request.RawUrl);
    }
}
